package com.neuedu.controller;


import com.neuedu.pojo.User;
import com.neuedu.service.IUserService;
import com.neuedu.util.CommentResult;
import com.neuedu.util.ResultCode;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wangle
 * @since 2020-09-16
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    IUserService userService;
    @PostMapping("/login")
    CommentResult login(User user){
        System.out.println("11111111");
       User user1 = userService.token(user);
       if(null!= user1){
            return  CommentResult.success(user1);
       }else{
          return CommentResult.failed("用户名或密码错误");
       }
   }


}
